package dev.zeno.booru;

public class Booru {
	
	public static final int DANBOORU = 0, GELBOORU = 1, CUSTOMBOORU = 2;
	
	private String name, url, favicon, username, password;
	private int id, type;
	
	public static final String DAN_POST_LIST = "/post/index.xml?love=true";
	public static final String GEL_POST_LIST = "/index.php?page=dapi&s=post&q=index";

	public Booru(int id, String name, String url, String favicon, int type, String username, String password) {
		super();
		this.id = id;
		this.type = type;
		this.name = name;
		this.url = url;
		this.favicon = favicon;
		this.username = username;
		this.password = password;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getFavicon() {
		return favicon;
	}

	public void setFavicon(String favicon) {
		this.favicon = favicon;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
	
	public String getTestURL()
	{
		switch(type)
		{
		case DANBOORU:
			return "http://"+url+DAN_POST_LIST;
		case GELBOORU:
			return "http://"+url+GEL_POST_LIST;
		default:
			return "http://"+url;
		}
	}
	
	public String getPostURL()
	{
		switch(type)
		{
		case DANBOORU:
			return url+DAN_POST_LIST+"&login="+username+"&password_hash="+SHA1.getSHA1("choujin-steiner--"+password+"--");
		case GELBOORU:
			return url+GEL_POST_LIST;
		default:
			return url;
		}
	}
	
}
